//
//  SelectDriverListCell.m
//  NtoccShipper
//
//  Created by mac on 2019/12/23.
//  Copyright © 2019 zhuchongjin. All rights reserved.
//

#import "SelectDriverListCell.h"
#import "HCSStarRatingView.h"

@interface SelectDriverListCell()
@property (nonatomic,strong) HCSStarRatingView *viewRate;
@property (nonatomic,strong) CJView *viewStar;
@property (nonatomic,strong) CJLabel *labName;
@property (nonatomic,strong) CJLabel *labStarNum;
@property (nonatomic,strong) CJLabel *labvehicleLoadStatusName;
@property (nonatomic,strong) CJLabel *labvehicleLoadWeightName;
//@property (nonatomic,strong) UIButton *btnSelect;
@property (nonatomic,strong) CJLabel *labCarNum;
@property (nonatomic,strong) CJLabel *labCarType;
@property (nonatomic,strong) CJImageView *imgVselect;
@end

@implementation SelectDriverListCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

- (void)setCellInfiWithModel:(DriverListModel *)model{
    
    [self.viewStar addSubview:self.viewRate];
     _viewRate.value = model.avgBasicGrade;
     self.labStarNum.text = CJStringWithFormat(@"%0.1f",model.avgBasicGrade);
     self.labName.text = model.name;
     self.labvehicleLoadStatusName.text = CJStringWithFormat(@"%@ ",[CJControl getThreeUnaryValueStr:model.vehicleLoadStatusName]);
     self.labvehicleLoadWeightName.text = CJStringWithFormat(@"%@ ",[CJControl getThreeUnaryValueStr:model.vehicleLoadWeightName]);
    NSString *str = @"";
    if (IsNilOrNull(model.vehicleClassificationName) || IsStrEmpty(model.vehicleClassificationName)) {
        str = @"";
    }else{
        str = model.vehicleClassificationName;
    }
    
    self.labCarType.text = CJStringWithFormat(@"车型:%@",str);
    self.labCarNum.text = model.vehicleLicenseNumber;
    if (model.selected) {
        self.imgVselect.image = [UIImage imageNamed:@"zcj_selectedCir"];
    }else{
        self.imgVselect.image = [UIImage imageNamed:@"zcj_unSelectedCir"];
    }
}

- (void)btnSelectDriverAction{
    if (self.blockSelect) {
        self.blockSelect(@"");
    }
}

- (HCSStarRatingView *)viewRate{
    if (!_viewRate) {
      _viewRate =   [[HCSStarRatingView alloc]initWithFrame:CGRectMake(0,0,110,30)];
        _viewRate.tintColor = [UIColor cjStarRateColor];
        _viewRate.starBorderColor = [UIColor cjClearColor];
        _viewRate.emptyStarColor = [UIColor cjEmptyStarRateColor];
        _viewRate.backgroundColor = [UIColor cjClearColor];
        _viewRate.enabled = NO;
        _viewRate.maximumValue = 5;
        _viewRate.minimumValue = 0;
        _viewRate.allowsHalfStars = YES;
    }
    return  _viewRate;
}

@end
